﻿namespace EFS.Common
{
	public static class Validators
	{
		private static System.Text.RegularExpressions.RegexOptions options = System.Text.RegularExpressions.RegexOptions.None;

		/// <summary>
		/// Validators
		/// </summary>
		static Validators()
		{
			// used options for reg ex
			options =
				System.Text.RegularExpressions.RegexOptions.ExplicitCapture |
#if !SILVERLIGHT
				System.Text.RegularExpressions.RegexOptions.Compiled |
#endif
				System.Text.RegularExpressions.RegexOptions.IgnoreCase;

			// create regExEmail
			RegExEmail = new System.Text.RegularExpressions.Regex(@"\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b", options);

			// create regExTelephone
			RegExTelephone = new System.Text.RegularExpressions.Regex(@"^[0-9, \ ]+$", options);

			// create regExMobile
			RegExMobile = new System.Text.RegularExpressions.Regex(@"^(^[0-9, \ ]+$)", options);

			// create regExDDAccountNumber
			RegExDDAccountNumber = new System.Text.RegularExpressions.Regex(@"^[0-9]{1}[\s]{0,}[\-]{0,1}[\s]{0,}[0-9]{1}[\s]{0,}[\-]{0,1}[\s]{0,}[0-9]{1}[\s]{0,}[\-]{0,1}[\s]{0,}[0-9]{1}[\s]{0,}[\-]{0,1}[\s]{0,}[0-9]{1}[\s]{0,}[\-]{0,1}[\s]{0,}[0-9]{1}[\s]{0,}[\-]{0,1}[\s]{0,}[0-9]{1}[\s]{0,}[\-]{0,1}[\s]{0,}[0-9]{1}$", options);

			// password
			RegExPassword = new System.Text.RegularExpressions.Regex(@"\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b", options);			
		}

		/// <summary>
		/// Email Reg Ex
		/// </summary>
		public static System.Text.RegularExpressions.Regex RegExEmail { get; private set; }

		/// <summary>
		/// Telephone Reg Ex
		/// </summary>
		public static System.Text.RegularExpressions.Regex RegExTelephone { get; private set; }

		/// <summary>
		/// Email Reg Ex
		/// </summary>
		public static System.Text.RegularExpressions.Regex RegExMobile { get; private set; }

		/// <summary>
		/// DD account Reg Ex
		/// </summary>
		public static System.Text.RegularExpressions.Regex RegExDDAccountNumber { get; private set; }

		/// <summary>
		/// Passowrd
		/// </summary>
		public static System.Text.RegularExpressions.Regex RegExPassword { get; private set; }
	}

}